package main

import "fmt"

func main() {

	//map创建方式
	var map3 = make(map[string]string)
	map3["name"] = "小红"
	map3["age"] = "28"
	map3["sex"] = "男"
	map3["addr"] = "湖南"

	var map1 = map[string]string{"name": "小王", "age": "18", "sex": "男", "addr": "湖北"}
	var map2 = map[string]string{"name": "小城", "age": "21", "sex": "女", "addr": "北京"}
	//使用make创建一个切片  记得类型前面的[]  根据切片的定义来的
	userDatas := make([]map[string]string, 0, 3)
	userDatas = append(userDatas, map1)
	userDatas = append(userDatas, map2)
	userDatas = append(userDatas, map3)
	fmt.Println(userDatas)
	for _, v := range userDatas {
		fmt.Printf("name:%s\n", v["name"])
		fmt.Printf("age:%s\n", v["age"])
		fmt.Printf("sex:%s\n", v["sex"])
		fmt.Printf("addr:%s\n", v["addr"])
	}
}
